﻿using System.Diagnostics.CodeAnalysis;
using System.Windows;
using System.Windows.Controls;

namespace Pfz.WpfControls
{
	/// <summary>
	/// Control used to put a label on the top-left of another data-control.
	/// </summary>
	public partial class LabellerControl:
		UserControl
	{
		/// <summary>
		/// Dependency property of DisplayName.
		/// </summary>
		public static readonly DependencyProperty LabelProperty = 
			DependencyProperty.Register
			(
				"Label",
				typeof(object),
				typeof(LabellerControl)
			);
		
		/// <summary>
		/// This strange construction tells to use the default-value of
		/// Style as typeof(LabellerControl).
		/// It is found in themes\generic.xaml (and must be located and called as such)
		/// </summary>
		[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
		static LabellerControl()
		{
			DefaultStyleKeyProperty.OverrideMetadata(typeof(LabellerControl), new FrameworkPropertyMetadata(typeof(LabellerControl)));
		}
		
		/// <summary>
		/// Gets or sets the label of this labeller control.
		/// </summary>
		public object Label
		{
			get
			{
				return GetValue(LabelProperty);
			}
			set
			{
				SetValue(LabelProperty, value);
			}
		}
	}
}
